Convert to second order sections 您所在的位置:网站首页 denominator coefficient Convert to second order sections

Convert to second order sections

2023-10-12 09:30| 来源: 网络整理| 查看: 265

Open Live Script

Convert an IIR discrete-time filter object to an SOS filter object that contains the corresponding SOS sections.

Design a 10th order lowpass Butterworth filter using the butter function.

N = 10; Fc = 0.4; [b,a] = butter(N,Fc);

Create a dsp.IIRFilter object and assign the designed coefficients to the Numerator and the Denominator properties of the object.

iir = dsp.IIRFilter(Numerator=b,Denominator=a)iir = dsp.IIRFilter with properties: Structure: 'Direct form II transposed' Numerator: [4.9945e-04 0.0050 0.0225 0.0599 0.1049 0.1259 0.1049 0.0599 0.0225 0.0050 4.9945e-04] Denominator: [1 -1.9924 3.0195 -2.8185 2.0387 -1.0545 0.4144 -0.1157 0.0225 -0.0027 1.4876e-04] InitialConditions: 0 Use get to show all properties

Use the sos function to convert the IIR filter object into an SOS filter that contains the corresponding SOS sections.

sosFilt = sos(iir)sosFilt = dsp.SOSFilter with properties: Structure: 'Direct form II transposed' CoefficientSource: 'Property' Numerator: [5x3 double] Denominator: [5x3 double] HasScaleValues: true ScaleValues: [4.9945e-04 1 1 1 1 1] Use get to show all properties

You can obtain the SOS matrix and scale values from the SOS filter object.

sMatrix = [sosFilt.Numerator,sosFilt.Denominator]sMatrix = 5×6 1.0000 2.0032 1.0005 1.0000 -0.3187 0.0313 1.0000 2.0846 1.0874 1.0000 -0.3345 0.0826 1.0000 2.0293 1.0321 1.0000 -0.3695 0.1958 1.0000 1.9655 0.9682 1.0000 -0.4317 0.3969 1.0000 1.9174 0.9199 1.0000 -0.5380 0.7410 sValues = sosFilt.ScaleValuessValues = 1×6 0.0005 1.0000 1.0000 1.0000 1.0000 1.0000

Compare these values to the values obtained using the tf2sos function and verify that they are the same.

[sMatrixfn,g] = tf2sos(b,a)sMatrixfn = 5×6 1.0000 2.0032 1.0005 1.0000 -0.3187 0.0313 1.0000 2.0846 1.0874 1.0000 -0.3345 0.0826 1.0000 2.0293 1.0321 1.0000 -0.3695 0.1958 1.0000 1.9655 0.9682 1.0000 -0.4317 0.3969 1.0000 1.9174 0.9199 1.0000 -0.5380 0.7410 g = 4.9945e-04 isequal(sMatrix,sMatrixfn)ans = logical 1 isequal(sValues(1),g)ans = logical 1


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有